/* Copyright (C) 2007-2008  klevgert  http://code.google.com/p/db4o-netbeans/

This file is part of the db4o-netbeans module suite.

db4o-netbeans is free software; you can redistribute it and/or modify it under
the terms of version 2 of the GNU General Public License as published
by the Free Software Foundation and as clarified by db4objects' GPL 
interpretation policy, available at
http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
Suite 350, San Mateo, CA 94403, USA.

db4o-netbeans is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. */


package com.db4o.nb.api;

import com.sun.org.apache.bcel.internal.generic.Type;
import java.util.List;
import org.openide.nodes.Node;

/**
 * This is the root for a connection to a db4o database and queries defined on it.
 * The class represents the db4o net beans file created in a java project.
 *
 * @author klevgert
 */
public interface Db4oProvider extends Node.Cookie {
  
  /**
   * Loads the db4o net beans file of type db4o. 
   */
  public void load();
  
  /**
   * Saves the db4o net beans file of type db4o and stores all changes. 
   */
  public void save();
  
  /**
   * Gets the db4o database which encapsualtes the db4o object container.
   * @return db4o database.
   */
  public Db4oDatabase getDatabase();

  /**
   * Gets the list of queries defined. 
   * @return list of queries.
   */
  public List getQueries();

  /**
   * Gets a host for a db4o database. Actually it is a small piece that starts as server and opens
   * access to the database. 
   * @return db4o server instance.
   */
  public Db4oServer getServerHost();
  
  
  /**
   * Creates a sql query wrapper object.
   * @param name          name of the query
   * @param expression    sql expression
   * @param type          java class
   * @return query wrapper object.
   */
  public QueryData createSqlQuery(String name, String expression, String type);

  /**
   * Creates a SODA query wrapper object.
   * @param name          name of the query
   * @param type          java class
   * @return query wrapper object.
   */
  public QueryData createSodaQuery(String name, String type);

  public Descend   createDescend(String type, String value);
  public Constrain createConstrain(String type, String value);
  public Constrain createNot();
  public Constrain createGreater();
  public Constrain createLess();
}
